const express = require('express')
const { fileOperation } = require('./utils')

const app = express()

app.get('/remove', (req, res) => {
  const result = fileOperation('todo.json', function (todoList) {
    return todoList.filter(todo => todo.id !== 3)
  })
  console.log(result)
  res.send(JSON.stringify(result))
})

app.listen(8080, function () {
  console.log('Listening on 8080')
})